<template>
  <div>
    <form>
      <label>姓名：</label>
      <input type="text" v-model="username" />
      <br />
      <br />

      <label>年龄：</label>
      <input type="number" v-model="age" />
      <br />
      <br />

      <label>身高：</label>
      <input type="number" v-model="hight" />(米)
      <br />
      <br />

      <label>体重：</label>
      <input type="number" v-model="weight" />(公斤)
      <br />
      <br />

      <label>病史：</label>
      <input type="text" v-model="bs" />
      <br />
      <br />

      <button @click.prevent="fn" >诊断</button>
    </form>

    <p>患者 的诊断结果：{{value}}</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: "",
      age: "",
      hight: "",
      weight: "",
      bs: "",
      res: "",
      value:''
    };
  },
  methods:{

    fn(){
      
      this.res=this.weight/(this.hight*this.hight)
      if(this.res>2){
        this.value='不健康'
      }else{
        this.value='正常'
      }
  }
}}
</script>
